#ifndef __PAGELIB_H__
#define __PAGELIB_H__

#include <iostream>
#include <map>
#include <string>
#include <vector>
#include <fstream>
#include <regex>
#include <cctype>
#include <tinyxml2.h>
using namespace std;
using namespace tinyxml2;
struct RssItem
{
    string title;
    string link;
    string description;
    string content;
};

class PageLib
{
    friend class PageLibPreprocessor;
public:
    PageLib();
    void parsePage(const char *filename);//解析网页
    void dumpPage(const string & filename);//生成网页库
    void createOffset();//生成偏移索引map
    void storeOffset(const string & filename);//生成偏移索引库文件
    vector<RssItem>& getpagelist()
    {
        return _rss;
    }
private:
    vector<RssItem> _rss;
    map<int,pair<long,long>> _offsetLib;//偏移索引map
    int i = 0;//文章数量
};




#endif